package com.moter.demo01.io.in_outputstream;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SequenceInputStreamDemo {
    public static void main(String[] args) throws IOException {
        List<InputStream> inputStreamList = new ArrayList<>();
        inputStreamList.add(new FileInputStream("src\\main\\java\\com\\moter\\demo01\\io\\in_outputstream\\filterstream\\bufferedIstream\\buffer.txt"));
        inputStreamList.add(new FileInputStream("src\\main\\java\\com\\moter\\demo01\\io\\in_outputstream\\filterstream\\datastream\\data.txt"));
        inputStreamList.add(new FileInputStream("src\\main\\java\\com\\moter\\demo01\\io\\in_outputstream\\filterstream\\pushbackstream\\pushback.txt"));
        inputStreamList.add(new FileInputStream("src\\main\\java\\com\\moter\\demo01\\io\\123.txt"));
        SequenceInputStream sequenceInputStream = new SequenceInputStream(Collections.enumeration(inputStreamList));
        int b;
        while((b=sequenceInputStream.read())!=-1){
            System.out.print((char)b);
        }
        sequenceInputStream.close();
    }
}
